<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 资产详情
 */
class PropertyInfo extends Model
{
    protected $table = 'property_info';

    protected $fillable = [
        'uid',
        'cid',
        'oid',
        'note',
        'num',
        'price',
        'total',
        'proc',
        'type',  //'类型 1充值 2提现 3 委托买入 4委托卖出 5 交易买入 6交易卖出
        'deal_type', //交易类型 1交易 2 手续费
        'status',
        'created_at',
        'updated_at'
    ];

    const STATUS_ONE      = 1;
    const STATUS_TWO      = 2;
    public static $STATUS = [
        self::STATUS_ONE   => '正常',
        self::STATUS_TWO   => '冻结',
    ];

    const type_a      = 1;
    const type_b      = 2;
    const type_c      = 3;
    const type_d      = 4;
    const type_e      = 5;
    const type_f      = 6;
    public static $type = [
        self::type_a   => '收入',
        self::type_b   => '支出',
        self::type_c   => '收入',
        self::type_d   => '支出',
        self::type_e   => '收入',
        self::type_f   => '支出',
    ];
    const type_1      = 1;
    const type_2      = 2;
    const type_3      = 3;
    const type_4      = 4;
    const type_5      = 5;
    const type_6      = 6;
    public static $type_t = [
        self::type_1   => '充值',
        self::type_2   => '提现',
        self::type_3   => '委托买入',
        self::type_4   => '委托卖出',
        self::type_5   => '交易买入',
        self::type_6   => '交易卖出',
    ];

    //关联用户
    public function user()
    {
        return $this->hasOne('App\\Models\\User', 'id', 'uid');
    }

    //关联币种
    public function currency()
    {
        return $this->hasOne('App\\Models\\Currency', 'id', 'cid');
    }
}
